home *** CD-ROM | disk | FTP | other *** search
- " -------------------------------------------------------------------- "
- " The Boopsi Class implements the AmigaTalk to BOOPSI functions. "
- " I'm NOT going to document how existing BOOPSI classes are imple- "
- " mented, you'll have to find that information from someone else! "
- ""
- " See BOOPSIComms.st & BOOPSIMethodIDs.st for special tags used by the "
- " BOOPSI system & look at the BoopsiClassNames Class below this Class. "
- " -------------------------------------------------------------------- "
-
- Class Boopsi :Object ! private rastPortObj iclassObj !
- [
- dispose
- " You eventually free the object using this method: "
- <primitive 238 0 private>.
-
- private <- nil.
-
- ^ nil
- |
- newBoopsiObject: classIDString in: iclassObject tags: tagArray
- " This is the general method of creating objects from 'boopsi' classes.
- * ('Boopsi' stands for "basic object-oriented programming system for
- * Intuition".)
- *
- * You specify a class either as iclassObject (for a private class) or
- * by its ID string (for public classes). If iclassObject is nil,
- * then the classID is used. See BoopsiClassNames below.
- *
- * You further specify initial "create-time" attributes for the
- * object via a TagItem list, and they are applied to the resulting
- * generic data object that is returned. The attributes, their meanings,
- * attributes applied only at create-time, and required attributes
- * are all defined and documented on a class-by-class basis.
- *
- * RETURNS
- * A boopsi object, which may be used in different contexts such
- * as a gadget or image, and may be manipulated by generic functions.
- * You eventually free the object using the dispose method.
- "
- ^ private <- <primitive 238 1 iclassObject classIDString tagArray>
- |
- xxxAddBoopsiClass
- " You don't need to call this method, makeClass:for:id:size:flags:
- * will take care of it for you!
- "
- <primitive 238 2 iclassObj>
- |
- removeBoopsiClass
- " Makes a public class unavailable for public consumption.
- * It's OK to call this function for a class which is not
- * yet in the internal public class list, or has been
- * already removed.
- "
- <primitive 238 3 iclassObj>
- |
- freeBoopsiClass ! success !
- success <- <primitive 238 4 iclassObj>.
-
- iclassObj <- nil. " Too late! It's all gone! "
-
- ^ success " Returns true if successful "
- |
- makeBoopsiClass: classID for: superClassObj id: superClassID size: size flags: flags
- " Make your own BOOPSI Class. classID & superClassID can be nil,
- * (which indicates a private BOOPSI Class). superClassObj
- * should NEVER be nil. size is the size of the instance data
- * that your class's objects will require, beyond that data defined
- * for your superclass's objects. flags should be zero for now
- * (unless you KNOW otherwise):
- "
- iclassObj <- <primitive 238 5 classID superClassID superClassObj size flags>.
-
- self xxxAddBoopsiClass.
-
- ^ iclassObj
- |
- obtainGIRPort: gadgetInfoObject
- " Sets up a RastPort for use (only) by custom gadget hook routines.
- * This function must be called EACH time a hook routine needing
- * to perform gadget rendering is called, and must be accompanied
- * by a corresponding call to releaseGIRPort.
- *
- * Note that if a hook function passes you a RastPort pointer,
- * e.g., GM_RENDER, you needn't call obtainGIRPort in that case.
- "
- ^ rastPortObj <- <primitive 238 6 gadgetInfoObject>
- |
- releaseGIRPort
- " Release a custom gadget RastPort Object from obtainGIRPort: "
- <primitive 238 7 rastPortObject>
- |
- getAttribute: attrID from: object into: storageObj
- ^ <primitive 238 8 attrID object storageObj>
- |
- setAttributes: anObject tags: tagArray
- " Specifies a set of attribute/value pairs with meaning as
- * defined by a 'boopsi' object's class.
- *
- * This function does not provide enough context information or
- * arbitration for boopsi gadgets which are attached to windows
- * or requesters. For those objects, use setGadgetAttributes:from:req:tags:
- *
- * The object does whatever it wants with the attributes you provide.
- * The return value tends to be non-zero if the changes would require
- * refreshing gadget imagery, if the object is a gadget.
- "
- ^ <primitive 238 9 anObject tagArray>
- |
- setGadgetAttributes: gadObj from: winObj req: reqObj tags: tagArray
- " Same as setAttributes:tags:, but provides context information and
- * arbitration for classes which implement custom Intuition gadgets.
- *
- * You should use this function for boopsi gadget objects which have
- * already been added to a requester or a window, or for "models" which
- * propagate information to gadget(s) already added.
- *
- * Typically, the gadgets will refresh their visuals to reflect
- * changes to visible attributes, such as the value of a slider,
- * the text in a string-type gadget, the selected state of a button.
- *
- * You can use this as a replacement for setAttributes:tags:, too,
- * if you specify nil for the 'winObj' and 'reqObj' parameters.
- *
- * The return value tends to be non-zero if the changes would require
- * refreshing gadget imagery, if the object is a gadget.
- "
- ^ <primitive 238 10 gadObj winObj reqObj tagArray>
- |
- nextObject: fromObject
- " This function is for boopsi class implementors only.
- *
- * When you collect a set of boopsi objects on an Exec List
- * structure by invoking their OM_ADDMEMBER method, you
- * can (only) retrieve them by iterations of this method.
- *
- * Works even if you remove and dispose the returned list
- * members in turn.
- "
- ^ <primitive 238 11 fromObject>
- |
- doGadgetMethod: gadObj from: winObj req: reqObj message: msgObj
- " Same as the DoMethod() function of amiga.lib, but provides context
- * information and arbitration for classes which implement custom
- * Intuition gadgets.
- *
- * You should use this method for boopsi gadget objects,
- * or for "models" which propagate information to gadgets.
- *
- * The object does whatever it wants with the message you sent,
- * which might include updating its gadget visuals.
- *
- * The return value is defined per-method.
- "
- ^ <primitive 238 12 gadObj winObj reqObj msgObj>
- |
- translateBoopsiErrorNumber
- ^ <primitive 238 13>
- ]
-
- " ------------------------------------------------------------------- "
- " BoopsiClassNames Class is a Singleton class that allows the user to "
- " reference BOOPSI Class name Strings as Symbols. "
- ""
- " The User does NOT need to create one of these, since Intuition "
- " Class will instantiate the only needed instance of this Class. See "
- " the SetupIntuition.st source file for the method(s) that help the "
- " User with this Class. "
- ""
- " ALL singleton classes MUST contain the following: "
- ""
- " the methods: isSingleton AND privateSetup AND "
- " uniqueInstance Class instance variable. "
- " ------------------------------------------------------------------- "
-
- Class BoopsiClassNames :Dictionary ! uniqueInstance !
- [
- isSingleton
- ^ true
- |
- privateNew ! newInstance !
- newInstance <- super new.
- ^ newInstance
- |
- new
- ^ (self privateSetup)
- |
- privateSetup
- (uniqueInstance isNil)
- ifTrue: [uniqueInstance <- self privateNew.
-
- self privateSetupDictionary.
- ].
-
- ^ self
- |
- privateSetupDictionary
-
- " Class id strings for Intuition classes. There's no real
- * reason to use the uppercase constants over the lowercase
- * strings, but this makes a good place to list the names of
- * the built-in (BOOPSI) classes:
- "
- self at: #ROOTCLASS put: 'rootclass'. " classusr.h "
- self at: #IMAGECLASS put: 'imageclass'. " imageclass.h "
- self at: #FRAMEICLASS put: 'frameiclass'.
- self at: #SYSICLASS put: 'sysiclass'.
- self at: #FILLRECTCLASS put: 'fillrectclass'.
- self at: #GADGETCLASS put: 'gadgetclass'. " gadgetclass.h "
- self at: #PROPGCLASS put: 'propgclass'.
- self at: #STRGCLASS put: 'strgclass'.
- self at: #BUTTONGCLASS put: 'buttongclass'.
- self at: #FRBUTTONCLASS put: 'frbuttonclass'.
- self at: #GROUPGCLASS put: 'groupgclass'.
- self at: #ICCLASS put: 'icclass'. " icclass.h "
- self at: #MODELCLASS put: 'modelclass'.
- self at: #ITEXTICLASS put: 'itexticlass'.
- self at: #POINTERCLASS put: 'pointerclass'. " pointerclass.h "
- ]
-